package com.lct.simpleforecast.ui.adapter

import android.view.View
import com.lct.simpleforecast.bean.CityBean
import com.lct.simpleforecast.ui.adapter.base.MyBaseAdapter
import kotlinx.android.synthetic.main.rv_city_item.view.*

/**
 * Author：SkySmile
 * Date：2018/7/16
 * Description：
 */
class CityAdapter(layoutId: Int, cityList: List<CityBean.HeWeather.Basic>,
                  private val itemClick: (CityBean.HeWeather.Basic) -> Unit)
    : MyBaseAdapter<CityBean.HeWeather.Basic>(layoutId, cityList) {
    /**
     * 绑定数据
     *
     * @param   itemView item布局
     * @param   dataBean 数据对象
     */
    override fun bindData(itemView: View, dataBean: CityBean.HeWeather.Basic) {
        with(dataBean) {
            itemView.tvArea.text = admin_area
            itemView.tvCity.text = parent_city
            itemView.tvLocation.text = location
            itemView.setOnClickListener { itemClick(this) }
        }
    }

}